{* $Id$ *}
{include_core file="admin/lib/header.html" title="序列号绑定记录"}
  <div class="page-header border-bottom clearfix">
    <h2 class="left">{$device_no}序列号绑定记录</h2>
    <a href="{AnUrl('machine/admin')}" class="btn btn-success btn-sm right"><i class="icon-add"></i>返回保温箱列表</a>
  </div>
  <!--start:列表-->
  <table class="list-table">
    <thead><tr>
      <th style="width:60px;">绑定门店</th>
      <th style="width:60px;">状态</th>
      <th style="width:60px;">时间</th>
    </tr></thead>
    <tbody>
      {foreach $record_list as $k=>$v}
        <tr id="dataList{$v.id}" {if $k%2 == 1} class="bg-gray"{/if} data-id="{$v.id}">
          <td>{$v.store_title}</td>
          <td>{store_config::$device_status[$v.status]}</td>
          <td>{$v.add_time}</td>
        </tr>
      {foreachelse}
          <tr><td class="txtleft" colspan="6">暂无数据</td></tr>
      {/foreach}
    </tbody>
    {if $status == 1}
    <tfoot><tr><td><input type="checkbox" class="selectAll"></td><td colspan="6"><a href="{AnUrl("store/admin/delete")}" class="btn btn-danger btn-xs deleteAll">批量禁用</a></td></tr></tfoot>
    {/if}
  </table>
  <script type="text/javascript">
  
  $(function(){
  	
      // 声明一个字段映射
      var field_mapping = new Array();
     
       field_mapping['id'] = '店铺id';
       field_mapping['user_name'] = '分店店长';
       field_mapping['owner_name'] = '总店店长';
	   /* field_mapping['agency_name'] = '经销商';
       field_mapping['marketing_name'] = '市场人员'; */
       field_mapping['type'] = '门店类型';
       field_mapping['store_title'] = '门店名称';
       field_mapping['cover'] = '门头图';
       field_mapping['store_order'] = '分店序号';
       field_mapping['address'] = '门店地址';
       field_mapping['score'] = '门店积分';
       field_mapping['level'] = '门店等级';
       field_mapping['sign_user_name'] = '签约人员';
       field_mapping['sign_user_mobile'] = '签约人员的手机号';
       field_mapping['sign_time'] = '签约时间';
       
       // 设备状态
       var device_status_arr = new Array();
       device_status_arr[0] = '出厂';
       device_status_arr[1] = '损坏';
       device_status_arr[2] = '正常';
       device_status_arr[3] = '停用';
       device_status_arr[404] = '暂无';
      
       
   // 将指定的元素设置为可视区域居中
      function center_format(obj){
          // 获取可是窗口的宽度
          var winWidth  = $(window).width();
          var winHeight = $(window).height();
          
          // 计算窗体本身的宽和高
          var objWidth = obj.width();
          var objHeight = obj.height();
          
          // 设置窗体的位置
          obj.css('position', 'fixed');
          // 计算left和top值
          var objLeft = (winWidth - objWidth)/2;
          // var objTop = (winHeight - objHeight)/3; // 如果除以2感觉不是垂直居中
          obj.css('left', objLeft+'px');
          obj.css('top', '20px');
          
      }
      
    // 高级搜索
    $('.js_advanced').click(function(e){
      e.preventDefault();
      var thisObj = $(this);
      var outBox  = thisObj.closest('form');
      if (thisObj.hasClass('js_isOpen')) {
        thisObj.removeClass('js_isOpen open');
        outBox.find('input').show();
        outBox.find('button').show();
        $('.js_advancedForm').hide();
      } else {
        thisObj.addClass('js_isOpen open');
        outBox.find('input').hide();
        outBox.find('button').hide();
        $('.js_advancedForm').show();
      }
    });
 
    // 查看门店信息
    $('.js_verifyStore').click(function(){
        // 获取此门店的id
        var url = $(this).attr('url');
        var th = $(this);
        // 发送ajax查询门店信息
        $.ajax({
            url : url,
            type : "get",
            dataType : 'json',
            error : function (res) {
                showMsg('暂无门店信息!');
            },
            success : function(res){
                if (res != 'no') {
                    var infoList = res;
                    $('.float-bg').show();
                    var list = $('.js_secondDealerList').clone(true, true);
                    
                   	// list.find('.js_dealerTitle').html('审核门店');
                   	
					list.find('.js_verifySuccess').attr('href', '{AnUrl("store/admin/recover_store")}'+'?id='+infoList['id']);
					$('body').append(list);

                    // 设置弹窗的位置
                    center_format(list);
                    list.show();
                    
                    // 说明 存在门店信息
					for (var i in infoList) {
					    var info = $('<tr><td style="width:200px;text-align:center;border:1px solid #ccc">'+field_mapping[i]+'</td><td style="width:200px;text-align:center;border:1px solid #ccc">'+infoList[i]+'</td></tr>');
					    list.find('.js_expressTable').append(info);
					}
                    
                    list.find('.js_closeDealerList').click(function(){
                        list.hide();
                        list.remove();
                        $('.float-bg').hide();
                    });
                    
                } else {
                    alert('暂无门店信息!');
                }
            }
        });
        
        return false;
    });

  });
  </script>
<div class="float-confirm js_secondDealerList" style="z-index: 20000;display: none; width:auto; height:auto; margin:0px; position : fixed;">
  <div class="float-confirm-con" style="margin:0px 0px; overflow:scroll;">
  	<a class="icon-close js_closeDealerList" href="javascript:void(0);">关闭</a>
    <p style="font-size:18px;color:#23a18b;" class="js_dealerTitle">门店审核</p>
    <div style="width:auto;height:1px;background:#CCC;margin-bottom:20px;"></div>
    <div style="width:500px;max-height:400px;over-flow:hidden;margin-bottom:15px;">
      <table style="line-height:50px;border:1px solid #ccc;margin:0 auto;" class="js_expressTable">
        <!-- <tr>
          <th style="width:200px;text-align:center;border:1px solid #ccc">用户名</th>
          <th style="width:200px;text-align:center;border:1px solid #ccc">手机号码</th>
        </tr> -->
        
      </table>
      <table style="line-height:50px;width:100%;line-height:24px;margin:0 auto; padding-left:20px;" class="js_refundTable">
      	<tr>
      		<td rolspan="2" style="text-align:center; padding-right:20px;" ><a href="javascript:;" class="btn btn-success right js_verifySuccess" style="width:50%;;margin:20px auto;"><i class="icon-trash icon-white"></i>审核通过</a></td>
      	</tr>
      </table>
    </div>
  </div>
</div>
<div class="float-bg" style="z-index: 19999; display: none"></div>
  {include_core file="admin/lib/pager.html"}
<!--end:列表-->
{load_js file='zclip/jquery.zclip.min.js'}
{load_js file='zclip/ZeroClipboard.js'}
{include_core file="admin/lib/footer.html"}